package com.anrongtec.zcpt.openapi.util;

import android.content.Context;
import android.content.SharedPreferences;

public class SPUtils {
	private static final String SP_NAME = "base_info";// FILE_NAME
	private static final String KEY_FINGER_ID = "finger_id";
	private static SharedPreferences mSharedPreferences;
	private static SharedPreferences.Editor editor;
	private static Context context;
	private static SPUtils instance;

	private SPUtils(Context context) {
		this.context = context;
	}

	public static final SPUtils getInstance(Context context) {
		if (instance == null) {
			synchronized (SPUtils.class) {
				if (instance == null) {
					instance = new com.anrongtec.zcpt.openapi.util.SPUtils(context.getApplicationContext());
				}
			}
			mSharedPreferences = context.getSharedPreferences(SP_NAME, Context.MODE_PRIVATE);
			editor = mSharedPreferences.edit();
		}
		return instance;
	}

	public void saveFingerId(String fingerId) {
		editor.putString(KEY_FINGER_ID, fingerId);
		editor.commit();
	}

	public String getFingerId() {
		return mSharedPreferences.getString(KEY_FINGER_ID, "");
	}

}
